package com.chagee.store.operation.server.transfer;




import com.chagee.store.operation.api.bo.EventBO;
import com.chagee.store.operation.server.entity.EventDO;
import org.springframework.util.CollectionUtils;

import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 闫海亮
 * @description:
 * @date 2023/8/9 17:15
 */
public class EventTransfer {
    public static EventBO toEventBO(EventDO eventDO) {
        if (eventDO == null) {
            return null;
        }
        EventBO eventBO = new EventBO();
        eventBO.setId(eventDO.getId());
        eventBO.setAppCode(eventDO.getAppCode());
        return eventBO;
    }

    public static List<EventBO> toEventBOList(List<EventDO> eventDOList) {
        if (CollectionUtils.isEmpty(eventDOList)) {
            return Collections.EMPTY_LIST;
        }
        return eventDOList.stream().map(EventTransfer::toEventBO).collect(Collectors.toList());
    }
}
